<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>地址管理</title>
	<link rel="stylesheet" href="css/jd_focuscss.css" />
	<link rel="stylesheet" href="css/myaddress.css" />
	<link rel="stylesheet" href="font/css/font-awesome.min.css" />
	<script type="text/javascript" src="Public/org/jquery.min.js"></script>
	<link rel="stylesheet" type="text/css" href="Public/org/hdjs/hdjs.css">
	<script type="text/javascript" src='Public/org/hdjs/hdjs.min.js' ></script>
	<script type="text/javascript" src="js/jd_topad.js" ></script>
	<script type="text/javascript" src="js/jd_shopcar.js" ></script>
	<link rel="stylesheet" type="text/css" href="Public/org/cityselect/css/main.css" />
	<script type="text/javascript" src="Public/org/cityselect/js/jquery.cityselect.js"></script>
	<script language="javascript" src="Public/org/common.js"></script>
	<script type="text/javascript">


	</script>
</head>
<body>
	<div id='background' class='hidden' style="display:none;position: absolute;top:0;left:0;height:100%;width:100%;background:#000;z-index: 100"></div>
	<!-- 左边导航条 -->
	<!-- 顶部导航区域开始  -->
	<div id="topad">
		<div class="center">

			<ul style="float:right;width:auto;">
				<?php if (isset($_SESSION['user_id'])): ?>
					<li class="a"><a class="hello" href="<?php echo U('Member/User/myInfo') ?>"><?php echo $_SESSION['username'] ?></a><a class="login" href="<?php echo U('Member/User/quit') ?>">退出</a><span class="line"></span></li>
				<?php else: ?>
					<li class="a"><a class="hello" href="<?php echo U('Member/User/login') ?>">你好，请登录</a><a class="login" href="<?php echo U('Member/User/register') ?>">免费注册</a><span class="line"></span></li>
				<?php endif ?>

				<li><a href="<?php echo U('Member/Index/order') ?>">我的订单</a><span class="line"></span></li>
				<li class="a side"><a href="<?php echo U('Member/Index/myInfo') ?>">我的京东</a>

				</li>

			</ul>
		</div>
	</div>
	<!-- 顶部导航区域结束 -->
	<!-- 搜索区域开始-->
	<div id="search_background">
		<div id="search">
			<img src="images/logo-201305.jpg" alt="" height="80" width="270" alt="" class="jd" />

			<form action="" class="search">
				<input class="text" type="text"  value="金龙鱼" />
				<input type="submit" class="submit" value="搜索" />
			</form>
			<a href="<?php echo __ROOT__ ?>" title="" class="home">首页</a>
			<div class="shopcar">
				<div class="over">
					<img src="images/sleep.png" height="49" width="57" alt="" />
					<p>购物车中还没有商品，赶紧选购吧！</p>
				</div>
				<div class="include">
					<span class="car"></span>
					<a href="">我的购物车</a>
					<span class="arrow">〉</span>
					<span class="logo">0</span>
				</div>
			</div>
		</div>
	</div>
	<!-- 搜索区域结束-->
	<!-- 主区域开始 -->
	<div id="item_content">
		<div class="center">
			<div class="left">
				<div class="order">
					<h3 class="order_title">
						订单中心
					</h3>
					<ul class="order_list">
						<li>
							<a href="<?php echo U('Member/Index/order') ?>" title="">
								我的订单
							</a>
						</li>
					</ul>
				</div>
				<div class="order">
					<h3 class="order_title">
						关注中心
					</h3>
					<ul class="order_list">
						<li>
							<a href="<?php echo U('Member/Index/focus') ?>" title="">
								我的关注
							</a>
						</li>
						<li>
							<a href="<?php echo U('Member/Index/scanHistory') ?>" title="">
								浏览历史
							</a>
						</li>
					</ul>
				</div>
				<div class="order">
					<h3 class="order_title">
						设置
					</h3>
					<ul class="order_list">
						<li>
							<a href="<?php echo U('Member/Index/myInfo') ?>" title="">
								个人信息
							</a>
						</li>
						<li>
							<a href="<?php echo U('Member/Index/myAddress') ?>" title="">
								收货地址
							</a>
						</li>
					</ul>
				</div>
			</div>
			<div class="right">
				<h3 class="my_order">
					收货地址
				</h3>
				<div class="all_order">
					<div class="status">
						<div class="mt">
							<a class="e-btn add-btn btn-5" href="javascript:;" id="a">新增收货地址</a>
							<span class="ftx-03">
								您已创建
								<span id="addressNum_top" class="ftx-02">
									3
								</span>
								个收货地址，最多可创建
								<span class="ftx-02">
									20
								</span>
								个
							</span>
							<script type="text/javascript">
								$(function  () {
									$('#ok').click(function() {
										$('#category').css({'display':'none'});
										$('#background').hide();
									});
									$( '.close-window' ).click( function () {
										$( this ).parent().parent().fadeOut();
										$( '#background' ).hide();

										return false;
									} );
									$( '#a' ).click( function () {
										dialog($( '#category' ));
									} );

								})

								function dialog (obj) {
									obj.css( {
										left : ( $( window ).width() - obj.width() ) / 2,
										top : $( document ).scrollTop() + ( $( window ).height() - obj.height() ) / 2
									} ).fadeIn();

									$( '#background' ).css( {
										opacity : 0.7,
										filter : 'Alpha(Opacity = 30)',
										'height' : $( document ).height()
									} ).show();
								}
								$( '.close-window' ).click( function () {
									$( this ).parent().parent().fadeOut();
									$( '#background' ).hide();
									return false;
								} );

							</script>

							<div id='category'>

								<p class='title'>
									<span>添加收货地址</span>
									<a href="javascript:void(0);" class='close-window'>X</a>
								</p>
								<div class='sel'>
									<form action="" id="form" style="padding: 30px 0;">
										<input type="hidden" name="address_id" id="address_id">
										<table class="hd-table hd-table-form hd-form">
											<thead>
												<tr>
													<td colspan="2">请认真填写收货信息</td>
												</tr>
											</thead>
											<tbody>

												<tr>
													<th class="hd-w100">*收货人：</th>
													<td>
														<input type="text" value="" name="consignee" id="consignee">
													</td>
												</tr>
												<tr>
													<th class="hd-w100">*所在地区：</th>
													<td>
														<div id="city"  class="fl address-info">
															<select name="province" class="hd-w100 prov" id="province">
															</select>
															<select name="city" disabled="disabled" class="hd-w100 city" id="city">
															</select>
															<select name="county" disabled="disabled" class="hd-w100 dist"  id="county">
															</select>
														</div>
													</td>
												</tr>
												<tr>
													<th class="hd-w100">*详细地址：</th>
													<td>
														<input type="text" value="" name="detailaddress" id="detailaddress" style="width: 90%">
													</td>
												</tr>
												<tr>
													<th class="hd-w100">*手机号码：</th>
													<td>
														<input type="text" value="" name="phonenumber"  placeholder="请输入手机号码" id="phonenumber">
													</td>
												</tr>
												<tr>
													<th class="hd-w100">固定电话：</th>
													<td>
														<input type="text" value="" name="telnumber" id="telnumber">
													</td>
												</tr>
												<tr>
													<th class="hd-w100">邮箱：</th>
													<td>
														<input type="text"  value="" placeholder="example@domain.com" name="emailaddress" id="emailaddress" style="width: 50%">
													</td>
												</tr>
												<tr>
													<th class="hd-w100">*地址别名：</th>
													<td>
														<input type="text" value="" name="nickaddress" id="nickaddress">
													</td>
												</tr>
											</tbody>
										</table>
									</form>
									<script type="text/javascript">
										ajaxPost("<?php echo U('Member/Index/myAddress') ?>",'form','btn','',function(data){
											location.href = location.href;
										});
									</script>
								</div>
								<p class='bottom'>
									<input type="submit" id='ok' value="保存收货地址" form="form">
								</p>
							</div>

						</div>
						<?php foreach ($data as $k => $v): ?>

							<div class="table">
								<div class="smt">
									<h3>
										<?php echo $v['consignee'] ?>
										<span class="ftx-04 ml10">默认地址</span>
									</h3>
									<div class="extra">
										<!-- <span style="float: right" class="del-btn" onclick="delAddress(this);">删除</span> -->

										<!-- <a style="float: right" class="del-btn" href="javascript:delAddress(this);">删除</a> -->

										<a style="float: right" class="del-btn" onclick="javascript:delAddress(this,<?php echo $v['address_id'] ?>);">删除</a>

										<!-- <a style="float: right" class="del-btn" href="javascript:delAddress(this,<?php echo $v['address_id'] ?>);">删除</a> -->

									</div>
								</div>

								<div class="smc">
									<div class="items new-items">
										<div class="item-lcol">
											<div class="item">
												<span class="label">收货人：</span>
												<div class="fl">
													<?php echo $v['consignee'] ?>
												</div>
												<div class="clr"></div>
											</div>
											<div class="item">
												<span class="label">所在地区：</span>
												<div class="fl">
													<?php echo $v['province'] ?><?php echo $v['city'] ?><?php echo $v['county'] ?>
												</div>
												<div class="clr"></div>
											</div>
											<div class="item">
												<span class="label">地址：</span>
												<div class="fl">
													<?php echo $v['detailaddress'] ?>
												</div>
												<div class="clr"></div>
											</div>
											<div class="item">
												<span class="label">手机：</span>
												<div class="fl">
													<?php echo $v['phonenumber'] ?>
												</div>
												<div class="clr"></div>
											</div>
											<div class="item">
												<span class="label">固定电话：</span>
												<div class="fl">
													<?php echo $v['telnumber'] ?>
												</div>
												<div class="clr"></div>
											</div>
											<div class="item">
												<span class="label">电子邮箱：</span>
												<div class="fl">
													<?php echo $v['emailaddress'] ?>
												</div>
												<div class="clr"></div>
											</div>
											<div class="item">
												<span class="label">*地址别名：</span>
												<div class="fl">
													<?php echo $v['nickaddress'] ?>
												</div>
												<div class="clr"></div>
											</div>
										</div>
										<div class="item-rcol">
											<div class="extra">
												<a class="ml10 ftx-05" href="javascript:getPayment(137905873,0,0);">使用轻松购</a>
												<a class="ml10 ftx-05" id="editaddress" href="javascript:editAddress(<?php echo $v['address_id'] ?>)">编辑</a>
											</div>
										</div>
									</div>
								</div>
							</div>
						<?php endforeach ?>
						<script type="text/javascript">


							function delAddress(obj,id)
							{

								$.post("<?php echo U('Member/Index/delAddress') ?>", {address_id: id}, function(data) {
									hd_alert({
										message: data.message,
										timeout: 3,
									});
									$(obj).parents('div.table').eq(0).remove();
								},'json');
							}

							// function delAddress(obj,id)
							// {

							// 	$.post("<?php echo U('Member/Index/delAddress') ?>", {address_id: id}, function(data) {
							// 		hd_alert({
							// 			message: data.message,
							// 			timeout: 3,
							// 		});
							// 		$(obj).parents('div.table').eq(0).remove();
							// 	},'json');
							// }
							function editAddress(address_id)
							{

								$.get("<?php echo U('Member/Index/editAddress') ?>",{address_id:address_id}, function(data) {
									$('#address_id').val(data.address_id);

									$('#consignee').val(data.consignee);

									$('#detailaddress').val(data.detailaddress);

									$('#phonenumber').val(data.phonenumber);

									$('#telnumber').val(data.telnumber);

									$('#emailaddress').val(data.emailaddress);

									$('#emailaddress').val(data.emailaddress);

									$('#nickaddress').val(data.nickaddress);

									$("#city").citySelect({
										prov:data.province,
										city:data.city,
										dist:data.county,
										nodata:"none"
									});
									dialog($( '#category' ));
								},'json');
							}

							$(function(){
								$("#city").citySelect({
									prov:'',
									city:'',
									dist:'',
									nodata:"none"
								});
							});
						</script>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- 主区域结束 -->
	<!-- <div style="height:100px;"></div> -->
	<!-- 底部服务开始 -->
	<div id="service" style="border-top:1px solid #dcdcdc;padding-top:10px;">
		<div class="part">
			<h3>购物指南</h3>
			<a href="">购物流程</a>
			<a href="">会员介绍</a>
			<a href="">生活旅行/团购</a>
			<a href="">常见问题</a>
			<a href="">大家电</a>
			<a href="">联系客服</a>
		</div>
		<div class="part2">
			<h3>配送方式</h3>
			<a href="">上门自提</a>
			<a href="">211限时达</a>
			<a href="">配送服务查询</a>
			<a href="">配送费收取标准</a>
			<a href="">海外配送</a>
		</div>
		<div class="part">
			<h3>支付方式</h3>
			<a href="">货到付款</a>
			<a href="">在线支付</a>
			<a href="">分期付款</a>
			<a href="">邮局汇款</a>
			<a href="">公司转账</a>
		</div>
		<div class="part">
			<h3>售后服务</h3>
			<a href="">售后政策</a>
			<a href="">价格保护</a>
			<a href="">退款说明</a>
			<a href="">返修/退换货</a>
			<a href="">取消订单</a>
		</div>
		<div class="part5">
			<h3>特色服务</h3>
			<a href="">夺宝岛</a>
			<a href="">DIY装机</a>
			<a href="">延保服务</a>
			<a href="">京东E卡</a>
			<a href="">京东通信</a>
		</div>
		<div class="part6">
			<h3>京东自营覆盖区县</h3>
			<p>京东已向全国1978个区县提供自营配送服务，支持货到付款、OS机刷卡和售后上门服务。</p>
			<a href="">查看详情 ></a>
		</div>
	</div>
	<!-- 底部服务结束 -->
	<!-- 底部索引开始 -->
	<div id="index">
		<p class="first">
			<a href="">关于我们</a>|
			<a href="">联系我们</a>|
			<a href="">商家入驻</a>|
			<a href="">营销中心</a>|
			<a href="">手机京东</a>|
			<a href="">友情链接</a>|
			<a href="">销售联盟</a>|
			<a href="">京东社区</a>|
			<a href="">京东公益</a>|
			<a href="">English Site</a>|
			<a href="">Contact Us</a>
		</p>
		<p class="second">
			<span>北京市公安局朝阳分局备案编号110105014669</span>|
			<span>京ICP证070359号</span>|
			<a href="">互联网药品信息服务资格证编号(京)-经营性-2014-0008</a>|
			<span>新出发京零 字第大120007号</span>
		</p>
		<p class="third">
			<a href="">音像制品经营许可证苏宿批005号</a>|
			<span>出版物经营许可证编号新出发(苏)批字第N-012号</span>|
			<span>互联网出版许可证编号新出网证(京)字150号</span>
		</p>
		<p class="fourth">
			<a href="">网络文化经营许可证京网文[2014]2148-348号  </a>
			<span>违法和不良信息举报电话：4006561155  Copyright © 2004-2015  京东JD.com 版权所有</span>
		</p>
		<p class="fifth">
			<span>京东旗下网站:</span>
			<a href="">360TOP</a>
			<a href="">拍拍网</a>
			<a href="">网银在线</a>
		</p>
		<div class="img">
			<img src="images/v.png" height="32" width="103" alt="" />
			<img src="images/v1.png" height="32" width="103" alt="" />
			<img src="images/v3.png" height="32" width="103" alt="" />
			<img src="images/v4.png" height="32" width="103" alt="" />
			<img src="images/v7.png" height="32" width="185" alt="" />
			<img src="images/v5.jpg" height="32" width="103" alt="" />
		</div>
	</div>
	<!-- 底部索引结束 -->
</body>
</html>